import java.util.ArrayList;
import java.util.Collection;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-06-28
 * Time: 10:38
 */
public class Test {
    public static void main(String[] args) {
        Collection<Student> coll = new ArrayList<>();

        Student student1 = new Student("dings",18);
        Student student2 = new Student("wangwu",16);
        Student student3 = new Student("lisi",17);

        coll.add(student1);
        coll.add(student2);
        coll.add(student3);

        Student s = new Student("dings",18);
        //contains方法的底层 实际上调用的是equals方法
        //所以 如果contains判断的是自定义类 那这个自定义类需要重写equals方法
        Boolean flg = coll.contains(s);

        System.out.println(flg);
    }
}
